gusucode.com > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM源码程序 > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM\stprtool\quadrat\qtransf.m

    function [Y]=qtransf(X)
% QTRANSF non-linear data mapping for quadratic function.
%  [Y]=qtransf(X)
%
% QTRANSF performs explicite non-linear data mapping for 
%   quadratic discriminant function. A quadratic separation 
%   surface in an original feature space X is mapped to a 
%   separation hyperplane in a new feature space Y. 
%
% Input:
%  X [NxK] contains K points in the original n-dimensional input space.
%
% Output:
%  Y [MxK] contains images of X in the new feature space. 
%
% where N is dimension of the input space,
%       M = 2*N+N*(N-1)/2 is dimension of the new feature space,
%       K is number of mapped points.
%
% See also QUADEMO, L2Q2D, PQUAD2D.
%

% Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac
% (c) Czech Technical University Prague, http://cmp.felk.cvut.cz
% Written Vojtech Franc (diploma thesis) 19.11.1999, 23.12.1999
% Modifications
% 26-June-2001, V.Franc, comments repared.
% 24. 6.00 V. Hlavac, comments polished.

% dimension
N=size(X,1);
% # of points
K=size(X,2);

% dimension of the new space
N2=2*N+N*(N-1)/2;

y=zeros(N2,K);

% first N members
Y(1:N,:)=X;

member=N+1;
for i=1:N,
   for j=i:N,
      Y(member,:)=X(i,:).*X(j,:);
      member=member+1;
   end
end